﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Web.Configuration;

public class PageHeaderData
{
    public static string GetPageKeywordsByType(NewsType newsType)
    {
        string sRetString=string.Empty;
        Dal.arParams.Clear();
        Dal.arParams.Add((int)newsType);
        DataTable DT=Dal.ExecuteDBsp("upd_GetPageKeywords",Dal.arParams);

        if(DT!=null)
            if(DT.Rows.Count>0)
                sRetString=DT.Rows[0]["Keywords"].ToString();
        return sRetString;
    }

    public static string GetPageKeywordsByCatID(int iCatID)
    {
        string sRetString = string.Empty;
        Dal.arParams.Clear();
        Dal.arParams.Add(iCatID);
        DataTable DT = Dal.ExecuteDBsp("upd_GetPageKeywords", Dal.arParams);

        if (DT != null)
            if (DT.Rows.Count > 0)
                sRetString = DT.Rows[0]["Keywords"].ToString();
        return sRetString;
    }

    public static void SetPageKeywordsForCatID(Int32 iCatID, string sKeywords)
    {
        string sRetString = string.Empty;
        Dal.arParams.Clear();
        Dal.arParams.Add(iCatID);
        Dal.arParams.Add(sKeywords);
        Dal.ExecuteDBsp("Admin_UpdatePageKeywords", Dal.arParams, true);
    }

    public static void SetPageKeywords(NewsType newsType,string sKeywords)
    {
        string sRetString = string.Empty;
        Dal.arParams.Clear();
        Dal.arParams.Add((int)newsType);
        Dal.arParams.Add(sKeywords);
        Dal.ExecuteDBsp("Admin_UpdatePageKeywords", Dal.arParams,true);
    }

    public static void SetArticleKeywords(int iArticleID,NewsType newsType, string sKeywords)
    {
        string sRetString = string.Empty;
        Dal.arParams.Clear();
        Dal.arParams.Add((int)newsType);
        Dal.arParams.Add(sKeywords);
        Dal.arParams.Add(iArticleID);
        Dal.ExecuteDBsp("Admin_UpdatePageKeywords", Dal.arParams, true);
    }

    public static string GetArticleKeywords(int iArticleID)
    {
        string sRetString = string.Empty;
        Dal.arParams.Clear();
        Dal.arParams.Add(iArticleID);
        DataTable DT = Dal.ExecuteDBsp("upd_GetArticleKeywords", Dal.arParams);

        if (DT != null)
            if (DT.Rows.Count > 0)
                sRetString = DT.Rows[0]["Keywords"].ToString();
        return sRetString;
    }
}

